﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bootstrap.MVC.Infrastructure.ClientEvent;
using Bootstrap.MVC.Utils;

namespace Bootstrap.MVC.Widgets
{
    public class ClientEventBuilderBase
    {
        private IEventHandlerModelBase model;


        public ClientEventBuilderBase(IEventHandlerModelBase model)
        {
            this.model = model;
        }

        public ClientEventBuilderBase Register(string eventName, string handler)
        {
            Guard.IsNotNullOrEmpty(eventName, "eventName");
            Guard.IsNotNullOrEmpty(handler, "handler");

            model.Events.Register(new ClientEvent(eventName, handler));

            return this;
        }
    }
}
